#ifndef __MCS__ELIF_BRANCH_LIST__HPP
#define __MCS__ELIF_BRANCH_LIST__HPP

#include "ElifBranch.hpp"

class ElifBranchList : public Object
{
public:
	ElifBranchList() {}

	void addBranch(ptr<ElifBranch> branch) { branches_.push_back(branch); }


	void init(Block * parentBlock)
	{
		for(size_t i = 0; i < branches_.size(); ++i)
		{
			branches_.at(i)->init(parentBlock);
		}
	}

	bool execute() const
	{
		for(size_t i = 0; i < branches_.size(); ++i)
		{
			bool done = branches_.at(i)->execute();
			if(done) return true;
		}
		return false;
	}
private:
	std::vector< ptr<ElifBranch> > branches_;
};

#endif //__MCS__ELIF_BRANCH_LIST__HPP
